// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.jasmin.unit.common;

import com.dustedpixels.jasmin.unit.Unit;

/**
 * Divides input clock frequency by two.
 * 
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class ClockDivider implements Unit {
  // (input) clock source
  public boolean IN;
  
  // (output) divided clock
  public boolean OUT = false;

  private boolean lastIn = false;
  
  public void updateEndPoints() {
    if (lastIn != IN) {
      if (IN) OUT = !OUT;
      lastIn = IN;
    }
  }
}
